<?php

namespace Buu\Modules\Sms\Apis;

use App\Http\Controllers\Controller;
use Doraemon\tools\WorkWeChat as tWorkWeChat;
use Illuminate\Http\Request;

class Intercept extends Controller
{
    public function index(Request $request)
    {
        $requestData = $request->all();
        if ($requestData) {
            foreach ($requestData as $msg) {
                if (is_array($msg)) {
                    //$content = $this->formatMsg($msg);
                    //tWorkWeChat::sendGroupRobootMsg(tWorkWeChat::AGENT_1000004, tWorkWeChat::ROBOT_SMS_INTERCEPT, $content);
                }
            }
        }
        return response()->json([
            'code' => 0,
            'msg'  => '成功'
        ]);
    }

    private function formatMsg($msg)
    {
        return "发件人：`{$msg['send_no']}`
收件人：`{$msg['secret_no']}`
发送时间：`{$msg['start_time']}`
短信内容：
> {$msg['sms_content']}";
    }
}
